<template>
 <div>
  御剑乘风来,除魔天地间!
  <hr>
  <bookCom :list="list">
     <template #look="obj" >
        <!-- {{obj.row.id}} -->
        <button @click="del(obj.row.id)">删除</button>
     </template>

  </bookCom>
 </div>
</template>
<script>
import bookCom from './library/BookCom.vue'
export default{
  components:{
  bookCom
  },
    name:'',
    data () {
        return {
            list:[]
        }  
    },
    created () {
      this.gitname()
  
    },
    computed:{
          
      
    },
    methods:{
      async gitname(){
      const res=await  this.$axios.get('http://ajax-api.itheima.net/api/books')
      console.log(res)
       this.list = res.data.data
      },
      del(id){
        console.log(id,666)
       this.list = this.list.filter(item=>item.id!=id)
      }
    }
}
</script>
<style lang='less'  scoped>
    
</style>
